import store from "@/store";

export const checkActivetity = (activity) => {
  //   console.log("获取的一些i情况了store", store.state.yywk.activetStatus);
  const {
    activeAt = "",
    activeEnd = "",
    activeList = [],
    availableNum = "",
    activeNum = "",
  } = store.state.yywk.activetStatus;
  if (!activeAt || !activeEnd) {
    console.log("渲染组件");
    return false;
  }
  if (new Date(activeEnd).getTime() < new Date().getTime()) {
    console.log("时间到了");
    console.log("渲染组件");
    return false;
  }
  if (!activeList.length) {
    return false;
  }
  const id = localStorage.getItem("shop_id");
  const findShelId = activeList.find((item) => item[0] == id);
  if (!findShelId) {
    return false;
  }
  if (activeNum > availableNum + activeNum) {
    return false;
  }
  return true;
};
